using GameMain.Editor.BuildPipeline.BuildPipelineCore;
using HybridCLR.Editor.Commands;
using UnityEditor;
using UnityEditor.Build.Reporting;
using UnityEditor.Il2Cpp;

namespace GameMain.Editor.BuildPipeline
{
    public partial class BuildPipeline : BuildPipelineCallbackBase
    {
        public override void OnPostBuildPlayerScriptDLLs(BuildReport report)
        {
            LinkGeneratorCommand.GenerateLinkXml();
        }

        public override void OnPreprocessBuild(BuildReport report)
        {
            Cleanup();
        }

        public override void OnPostGenerateGradleAndroidProject(string path)
        {
#if UNITY_ANDROID
            PostStreamingData(BuildTarget.Android, path);
#endif
        }

        public override void OnBeforeConvertRun(BuildReport report, Il2CppBuildPipelineData data)
        {
            CopyBuildToolsPath();
#if !UNITY_ANDROID && !UNITY_IPHONE
            PostStreamingData(data.target);
#endif
        }

        public override void OnPostprocessBuild(BuildReport report)
        {
#if UNITY_IPHONE
            PostStreamingData(BuildTarget.iOS);
#endif
        }
    }
}
